<?php
	$path_to = $_GET["expo"];
	$expo = pathinfo($_GET["expo"]);
	$expo = $expo["filename"];
	$server_name = $_SERVER["SERVER_NAME"];
	$path = str_replace("/main.php", "", $_SERVER["SCRIPT_NAME"]);
	$u = "http://$server_name$path/exposition.php?expo=$expo";
	$tiny = @file_get_contents('http://tinyurl.com/api-create.php?url='.$u);
	if (!$tiny){
		oyster_log("ERROR", sprintf((string)$language->errors->value_26,$u), "MonaLisa url");
		$head->_template_assign("ERROR", sprintf((string)$language->errors->value_26,$u));
	} else {
		oyster_log("SUCCESS", "tinyURL erstellt.", "MonaLisa url");
		if ($_GET["update"] != true){
			$handler = sqlite_open($path_to);
			sqlite_query($handler, "INSERT INTO expo (exhibit,type) VALUES ('$tiny', 'tiny')");
			sqlite_close($handler);
		} else {
			$handler = sqlite_open($path_to);
			sqlite_query($handler, "UPDATE expo SET exhibit='$tiny' WHERE (type='tiny')");
			sqlite_close($handler);
		}
		$head->_template_assign("STATUS", (string)$language->stati->value_11);
	}
	
	$_GET["mode"] = "";
	include("Applications/monalisa/monalisa.php")
?>